<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-local.php',
    require __DIR__ . '/params.php',
    require __DIR__ . '/params-local.php'
);

return [
    'id' => 'app-backend',
    'defaultRoute'=>'index',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [],

    'components' => [
        //注册是否使用压缩的文件
//        'assetManager'=>[
//            'class'=>'yii\web\AssetManager',
//            'bundles'=>[
//                'yii\web\JqueryAsset'=>[
//                    'js'=>[
//                        YII_ENV_DEV?'jquery.js':'jquery.min.js'
//                    ],
//                ]
//            ]
//        ],

        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'image' => [
            'class' => 'yii\image\ImageDriver',
            'driver' => 'GD',  //GD or Imagick
        ],
        'admin' => [
            'class'=>'yii\web\user',
            'identityClass' => 'backend\models\Admin',
            'loginUrl'=>['public/login'],
            'idParam' =>'_admin',
            'identityCookie'=>['name'=>'_identity-backend','httpOnly'=>true],
            'returnUrl'=>['index/index']
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],

            'mailer' => [
                'class' => 'yii\swiftmailer\Mailer',
                'viewPath' => '@common/mail',//
                'useFileTransport' =>false,//这句一定有，false发送邮件，true只是生成邮件在runtime文件夹下，不发邮件
                'transport' => [
                    'class' => 'Swift_SmtpTransport',
                    'host' => 'smtp.qq.com',  //每种邮箱的host配置不一样
                    'username' => '1115007981@qq.com',
                    'password' => 'yodpenlpydyohffc',
                    'port' => '465',
                    'encryption' => 'ssl',

                ],

            ],

        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        /*
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'rules' => [
            ],
        ],
        */
    ],
    'params' => $params,
];
